package com.ckr.controller;

import com.ckr.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Shadowckr
 * @create 2022-01-18 11:58
 */

@Controller
public class HelloController {

    @RequestMapping({"/", "/index"})
    @ResponseBody
    public String hello() {
        return "hello,swagger!";
    }

    //只要这个实体在请求接口的返回值上（即使是泛型），都能映射到实体项中
    @RequestMapping("/getUser")
    public User getUser() {
        return new User();
    }

    @ApiOperation("Ace的接口")
    @PostMapping("/ace")
    @ResponseBody
    public String ace(@ApiParam("这个名字会被返回") String username) {
        return username;
    }
}
